//
//  HeaderCollectionReusableView.m
//  Cook
//
//  Created by 0.0 on 15-4-17.
//  Copyright (c) 2015年 dingjun. All rights reserved.
//

#import "HeaderCollectionReusableView.h"

@implementation HeaderCollectionReusableView

- (void)dealloc
{
    [_diseaseDiscusLabel release];
    [_diseaseLabel release];
    [_moreButton release];
    [_headerView release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.headerView = [[UIView alloc] initWithFrame:CGRectMake(self.bounds.origin.x + 10, self.bounds.origin.y + 5, self.frame.size.width - self.frame.size.width / 7, self.frame.size.height)];
        self.headerView.backgroundColor = [UIColor whiteColor];
        
        self.diseaseLabel = [[UILabel alloc] initWithFrame:CGRectMake(_headerView.bounds.origin.x + 5, _headerView.bounds.origin.y + 5, _headerView.frame.size.width / 5, _headerView.frame.size.height / 5)];
        self.diseaseLabel.text = @"症状简介";
        self.diseaseLabel.font = [UIFont systemFontOfSize:15.0f];
        
        self.diseaseDiscusLabel = [[UILabel alloc] initWithFrame:CGRectMake(_diseaseLabel.frame.origin.x + _diseaseLabel.frame.size.width + 5, _diseaseLabel.frame.origin.y, _headerView.frame.size.width - _diseaseLabel.frame.size.width - 10, _headerView.frame.size.height - 10)];

        self.diseaseDiscusLabel.numberOfLines = 5;
        self.diseaseDiscusLabel.font = [UIFont systemFontOfSize:15.0f];
        
        self.moreButton = [[UIButton alloc] initWithFrame:CGRectMake(_diseaseDiscusLabel.frame.origin.x + _diseaseDiscusLabel.frame.size.width, _diseaseDiscusLabel.frame.origin.y, self.frame.size.width - 10 - _headerView.frame.size.width, _headerView.frame.size.height)];
        [self.moreButton setTitle:@"详   情" forState:UIControlStateNormal];
        self.moreButton.titleLabel.numberOfLines = 2;
        self.moreButton.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.moreButton.backgroundColor = [UIColor purpleColor];
        
        
        self.moreButton.layer.cornerRadius = 10.0f;
        
        
       
        [_headerView addSubview:_diseaseDiscusLabel];
        [_diseaseDiscusLabel release];
        [_headerView addSubview:_diseaseLabel];
        [_diseaseLabel release];
        [self addSubview:_moreButton];
        [_moreButton release];
        [self addSubview:_headerView];
        [_headerView release];
    }
    
    return self;
}

//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//    CGRect rect = self.moreButton.frame;
//    rect.origin.x = 0;
    
//}

@end
